$ dotnet new webapi
$ dotnet new gitignore
$ dotnet run
Example Controller
$ code .
Add Book class
Book.cs
Add BooksController class
BooksController.cs
$ dotnet run
https://localhost:5001/books
https://localhost:5001/books/1788395549
https://localhost:5001/books/1234567890
Notice that by default Swagger is available.
https://localhost:5001/swagger/index.html
Support for Swagger is added in the project's Startup.cs file
Startup.cs
Static files can be added to a wwwroot folder in a Dotnet Core webapi project.
The static files can be image files, html files and javascript files.
To enable the static files add "app.UseStaticFiles();" to Startup.cs as shown below.
app.UseStaticFiles()
The static files can be a React app that calls the REST API exposed by the (same) Dotnet Core project.
App.js
index.html
Running React/Dotnet Core app
The BooksController code can be extended to support POST, PUT and DELETE actions
haddley_power_app_api
BookController.cs